package easy;

public class Solution_1974 {

    public int minTimeToType(String word) {
        int count = 0;
        char pre = 'a';
        for (int i = 0; i < word.length(); i++) {
            char c = word.charAt(i);
            int abs = Math.abs(c - pre);
            count += Math.min(abs, 26 - abs);
            count++;
            pre = c;
        }
        return count;
    }

    public static void main(String[] args) {
        Solution_1974 model = new Solution_1974();
        System.out.println(model.minTimeToType("abc"));
        System.out.println(model.minTimeToType("bza"));
    }
}
